package com.server.domain.process;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Coordinate---(x,y)坐标
 *      提供JSON序列化方法
 */

public class Coordinate {
    //横坐标
    private double x;
    //纵坐标
    private double y;

    //封装成JSON
    public static String CoordinateToJson(Coordinate coordinate) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(coordinate);
        return json;
    }
}
